{extend name="public/base"}

{block name="x-body"}
<style>
    .layui-form-item .layui-input-inline {
        width: 300px;
    }

    #goods th,td {
        text-align: center;
    }
</style>
    <div class="x-body">
        <form class="layui-form">
            <input type="hidden" name="id" value="{$order.id}" />
            <input type="hidden" name="shipping_price" value="{$order.shipping_price}" >
            <input type="hidden" name="discount" value="{$order.discount}" >
          <div class="layui-form-item">
              <label for="consignee" class="layui-form-label">
                  <span class="x-red">*</span>收货人
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="consignee" name="consignee" required="" lay-verify="required"
                  autocomplete="off" class="layui-input" value="{$order.consignee}">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="mobile" class="layui-form-label">
                  <span class="x-red">*</span>手机
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="mobile" name="mobile" required="" lay-verify="phone"
                  autocomplete="off" class="layui-input" value="{$order.mobile}" onfocus="isNum(this)">
              </div>
          </div>

            <div class="layui-form-item" id="x-city">
                <label class="layui-form-label">收货地址</label>
                <div class="layui-input-inline">
                    <select name="province" lay-filter="province">
                        <option value="">请选择省</option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="city" lay-filter="city">
                        <option value="">请选择市</option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="district" lay-filter="area">
                        <option value="">请选择县/区</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="address" class="layui-form-label">
                    <span class="x-red">*</span>具体地址
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="address" name="address" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" value="{$order.address}">
                </div>
            </div>

          <div class="layui-form-item">
              <label for="shipping_code" class="layui-form-label">
                  <span class="x-red">*</span>配送物流
              </label>
              <div class="layui-input-inline">
                  <select id="shipping_code" name="shipping_code" class="valid">
                    <option value="">请选择物流</option>
                      {volist name="order.shipping" id="v"}
                        <option value="{$v.shipping_code}-{$v.shipping_name}" {if $order.shipping_code == $v.shipping_code}selected{/if}>{$v.shipping_name}</option>
                      {/volist}
                  </select>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="pay" class="layui-form-label">
                  支付方式
              </label>
              <div class="layui-input-inline">
                  <select id="pay" name="pay">
                    <option value="">请选择支付方式</option>
                      {volist name="order.payment" id="v"}
                        <option value="{$v.code}-{$v.name}">{$v.name}</option>
                      {/volist}
                  </select>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="invoice_title" class="layui-form-label">
                  发票抬头
              </label>
              <div class="layui-input-inline">
                  <select id="invoice_title" name="invoice_title">
                      <option value="">不需要</option>
                      <option value="个人" {$order.invoice_title == '个人' ? 'selected' : ''}>个人</option>
                      <option value="公司" {$order.invoice_title == '公司' ? 'selected' : ''}>公司</option>
                  </select>
              </div>
          </div>

          <div class="layui-form-item layui-form-text">
              <label class="layui-form-label">
                  商品列表
              </label>
              <div class="layui-input-block">
                  <table class="layui-table" id="goods">
                      <thead>
                        <tr>
                            <th>商品名称</th>
                            <th>规格</th>
                            <th>价格</th>
                            <th>会员折扣价</th>
                            <th width="70">数量</th>
                            <!--<th>操作</th>-->
                        </tr>
                      </thead>
                    <tbody>
                        {volist name="order.goods" id="v"}
                          <tr>
                            <td>
                                <img src="{:config('imgRoute')}{$v.original_img}" alt="" width="30" height="30">
                                {$v.goods_name}
                            </td>
                              <td>{$v.spec_key_name}</td>
                            <td>{$v.goods_price}</td>
                            <td>{$v.member_goods_price}</td>
                            <td>
                                <input type="text" style="text-align: center; padding-left: 0;" class="layui-input x-sort" name="goods[{$v.id}][goods_num]" value="{$v.goods_num}" onfocus="isNum(this)">
                                <input type="hidden" name="goods[{$v.id}][goods_price]" value="{$v.goods_price}" >
                                <input type="hidden" name="goods[{$v.id}][member_goods_price]" value="{$v.member_goods_price}" >
                            </td>
                            <!--<td>-->
                                <!--<a title="删除" onclick="member_del(this,'{$v.id}', '{:url(\'ad/ad_del\')}')" href="javascript:;">-->
                                    <!--<i class="layui-icon">&#xe640;</i>-->
                                <!--</a>-->
                            <!--</td>-->
                          </tr>
                        {/volist}
                    </tbody>
                  </table>
              </div>
          </div>
          <div class="layui-form-item layui-form-text">
              <label for="admin_note" class="layui-form-label">
                  管理员描述
              </label>
              <div class="layui-input-block">
                  <textarea placeholder="请输入内容" id="admin_note" name="admin_note" class="layui-textarea">{$order.admin_note}</textarea>
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">
              </label>
              <button  class="layui-btn" lay-filter="edit" lay-submit="">
                  修改
              </button>
          </div>
      </form>
    </div>
<script>
    layui.use(['form','code'], function(){
        form = layui.form;

        layui.code();

        $('#x-city').xcity('{$order.province}', '{$order.city}', '{$order.district}');
    });

    formData('{:url("orders/order_form")}', 'edit', false, true);
</script>
{/block}